#include "pwm.h"


/**
 * @brief pwm初始化
 * @param None
 * @retval None
 * @note 一般配置步骤：
	0、配置时钟
	1、配置GPIO复用
	2、配置结构体
	3、初始化定时器
 */
void pwm_init(void)
{
	Timer_A_PWMConfig pwmConfig;
	
	
	//配置GPIO复用
	GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P7,GPIO_PIN7,GPIO_PRIMARY_MODULE_FUNCTION);
	
	
	//配置结构体
    pwmConfig.clockSource = TIMER_A_CLOCKSOURCE_SMCLK;
    pwmConfig.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;
    pwmConfig.timerPeriod = 4799;
    pwmConfig.compareRegister = TIMER_A_CAPTURECOMPARE_REGISTER_1;
    pwmConfig.compareOutputMode = TIMER_A_OUTPUTMODE_TOGGLE_SET;
    pwmConfig.dutyCycle = 0;
	
	
	//初始化定时器
	Timer_A_generatePWM(TIMER_A1_BASE,&pwmConfig);
}






